package com.xpffly.design.factory.abs;

import com.xpffly.design.factory.abs.factory.AbstractCreator;
import com.xpffly.design.factory.abs.factory.Creator1;
import com.xpffly.design.factory.abs.factory.Creator2;
import com.xpffly.design.factory.abs.service.AbstractProductA;
import com.xpffly.design.factory.abs.service.AbstractProductB;
import com.xpffly.design.factory.abs.service.AbstractProductN;

/**
 * @Author: xpengfei
 * @Date: 2021/3/27 23:45
 * @Description：场景类
 */
public class Scene {
    public static void main(String[] args) {
        // 定义出两个工厂
        AbstractCreator creator1 = new Creator1();
        AbstractCreator creator2 = new Creator2();

        // 生产产品A
        AbstractProductA productA1 = creator1.createProductA();
        productA1.commonMethod();
        productA1.doSomething();
        AbstractProductA productA2 = creator2.createProductA();
        productA2.commonMethod();
        productA2.doSomething();

        // 生产产品N
        AbstractProductB productB1 = creator1.createProductB();
        productB1.commonMethod();
        productB1.doSomething();
        AbstractProductB productB2 = creator2.createProductB();
        productB2.commonMethod();
        productB2.doSomething();

        // 生产产品N
        AbstractProductN productN1 = creator1.createProductN();
        productN1.commonMethod();
        productN1.doSomething();
        AbstractProductN productN2 = creator2.createProductN();
        productN2.commonMethod();
        productN2.doSomething();

    }
}
